const isProduction = process.env.NODE_ENV === 'production';

module.exports = {
	publicPath: "./",
	productionSourceMap: false,
	devServer: {
		proxy: {
			'/api': {
				target: 'http://localhost:8080',
				changeOrigin: true,
				pathRewrite: {
					'^/api': '/mock'
				}
			}
		}
	},
	configureWebpack: config => {
		const plugins = [];
		if (isProduction) {
			plugins.push(
				new UglifyJsPlugin({
					uglifyOptions: {
						output: {
							comments: false, // 去掉注释
						},
						warnings: false,
						compress: {
							drop_console: true,
							drop_debugger: false,
							pure_funcs: ['console.log']//移除console
						}
					}
				})
			)
		}
	},

}
